﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HtmlDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            //System.Web.HttpUtility类需要引用System.Web.dll后才能使用
            //<b>强调</b>转义
            Console.WriteLine("<b>强调</b>转义后为:{0}", System.Web.HttpUtility.HtmlEncode("<b>强调</b>"));
            Console.WriteLine("");
            //&lt;b&gt;强调&lt;/b&gt;转义解码
            Console.WriteLine("&lt;b&gt;强调&lt;/b&gt;转义解码后为:{0}", System.Web.HttpUtility.HtmlDecode("&lt;b&gt;强调&lt;/b&gt;"));

            Console.ReadKey();
        }
    }
}
